package com.iot.core.springboot;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;

@Data
@EqualsAndHashCode

@JsonInclude(JsonInclude.Include.NON_NULL)
public class MyApiResult    {
    public  MyApiResult(){

    }
    @JsonProperty(value ="code")
    private Integer code=0;
    @JsonProperty(value ="msg")
    private  String msg="";
    @JsonProperty(value ="data")
    private Object data;

    public  static  MyApiResult success(Object o){
        var m=new MyApiResult ();
        m.setData(o);
        return m;
    }
    public static   MyApiResult  other(Integer code,String msg,Object data) {
        var result = new MyApiResult();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }

}
